﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcShop.Models;

namespace MvcShop.Models.Repositories
{
    public class RCategory : BaseRepository, ICategory
    {
        #region IRepository<Category> 成员

        public Category GetById(int id)
        {
            return sse.Categories.Single(c => c.CategoryId == id);
        }

        public IQueryable<Category> GetAll()
        {
            return sse.Categories.Select(c=>c);
        }

        public void Add(Category entity)
        {
            sse.AddToCategories(entity);
            sse.SaveChanges();
        }

        public void Delete(Category entity)
        {
            throw new NotImplementedException();
        }

        public void Update(Category entity)
        {
            throw new NotImplementedException();
        }

        #endregion 
    }
}
